package com.mayflygeek.mayflyask.framework.webmvc.event;

import java.util.List;

import com.google.common.collect.Lists;

/**
 * @author 虫虫
 * @team 蜉蝣极客
 * @link www.mayflygeek.com
 * @Emial chongchong@mayflygeek.com
 * 
 */
public abstract class AbstractEventSupport implements EventSupport {
	private List<EventListener> listeners = Lists.newArrayList();

	@Override
	public void publishEvent(Event event) {
		for (EventListener listener : listeners) {
			listener.handleEvent(event);
		}

	}

	@Override
	public void addListener(EventListener eventListener) {
		if (!listeners.contains(eventListener)) {
			listeners.add(eventListener);
		}
	}

}
